<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<link rel="STYLESHEET" href="lib.css" type='text/css' />
<link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" />
<link rel='start' href='../index.html' title='Python documentation Index' />
<link rel="first" href="lib.html" title='Python library Reference' />
<link rel='contents' href='contents.html' title="Contents" />
<link rel='index' href='genindex.html' title='Index' />
<link rel='last' href='about.html' title='About this document...' />
<link rel='help' href='about.html' title='About this document...' />
<link rel="next" href="node176.html" />
<link rel="prev" href="mailbox-objects.html" />
<link rel="parent" href="module-mailbox.html" />
<link rel="next" href="mailbox-maildirmessage.html" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name='aesop' content='information' />
<title>7.3.2 Message objects</title>
</head>
<body>
<div class="navigation">
<div id='top-navigation-panel' xml:id='top-navigation-panel'>
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td class='online-navigation'><a rel="prev" title="7.3.1.5 MMDF"
  href="mailbox-mmdf.html"><img src='../icons/previous.png'
  border='0' height='32'  alt='Previous Page' width='32' /></a></td>
<td class='online-navigation'><a rel="parent" title="7.3 mailbox  "
  href="module-mailbox.html"><img src='../icons/up.png'
  border='0' height='32'  alt='Up one Level' width='32' /></a></td>
<td class='online-navigation'><a rel="next" title="7.3.2.1 MaildirMessage"
  href="mailbox-maildirmessage.html"><img src='../icons/next.png'
  border='0' height='32'  alt='Next Page' width='32' /></a></td>
<td align="center" width="100%">Python Library Reference</td>
<td class='online-navigation'><a rel="contents" title="Table of Contents"
  href="contents.html"><img src='../icons/contents.png'
  border='0' height='32'  alt='Contents' width='32' /></a></td>
<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
  border='0' height='32'  alt='Module Index' width='32' /></a></td>
<td class='online-navigation'><a rel="index" title="Index"
  href="genindex.html"><img src='../icons/index.png'
  border='0' height='32'  alt='Index' width='32' /></a></td>
</tr></table>
<div class='online-navigation'>
<b class="navlabel">Previous:</b>
<a class="sectref" rel="prev" href="mailbox-mmdf.html">7.3.1.5 MMDF</a>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="module-mailbox.html">7.3 mailbox  </a>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="mailbox-maildirmessage.html">7.3.2.1 MaildirMessage</a>
</div>
<hr /></div>
</div>
<!--End of Navigation Panel-->

<h2><a name="SECTION009320000000000000000"></a>
<a name="mailbox-message-objects"></a>
<br>
7.3.2 <tt class="class">Message</tt> objects
</h2>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><span class="typelabel">class</span>&nbsp;<tt id='l2h-1408' xml:id='l2h-1408' class="class">Message</tt></b>(</nobr></td>
  <td><var></var><big>[</big><var>message</var><big>]</big><var></var>)</td></tr></table></dt>
<dd>
A subclass of the <tt class="module">email.Message</tt> module's <tt class="class">Message</tt>. Subclasses
of <tt class="class">mailbox.Message</tt> add mailbox-format-specific state and behavior.

<p>
If <var>message</var> is omitted, the new instance is created in a default, empty
state. If <var>message</var> is an <tt class="class">email.Message.Message</tt> instance, its
contents are copied; furthermore, any format-specific information is converted
insofar as possible if <var>message</var> is a <tt class="class">Message</tt> instance. If
<var>message</var> is a string or a file, it should contain an <a class="rfc" id='rfcref-99521' xml:id='rfcref-99521'
href="http://www.faqs.org/rfcs/rfc2822.html">RFC 2822</a>-compliant
message, which is read and parsed.
</dl>

<p>
The format-specific state and behaviors offered by subclasses vary, but in
general it is only the properties that are not specific to a particular mailbox
that are supported (although presumably the properties are specific to a
particular mailbox format). For example, file offsets for single-file mailbox
formats and file names for directory-based mailbox formats are not retained,
because they are only applicable to the original mailbox. But state such as
whether a message has been read by the user or marked as important is retained,
because it applies to the message itself.

<p>
There is no requirement that <tt class="class">Message</tt> instances be used to represent
messages retrieved using <tt class="class">Mailbox</tt> instances. In some situations, the
time and memory required to generate <tt class="class">Message</tt> representations might not
not acceptable. For such situations, <tt class="class">Mailbox</tt> instances also offer
string and file-like representations, and a custom message factory may be
specified when a <tt class="class">Mailbox</tt> instance is initialized. 

<p>

<p><br /></p><hr class='online-navigation' />
<div class='online-navigation'>
<!--Table of Child-Links-->
<a name="CHILD_LINKS"><strong>Subsections</strong></a>

<ul class="ChildLinks">
<li><a href="mailbox-maildirmessage.html">7.3.2.1 <tt class="class">MaildirMessage</tt></a>
<li><a href="mailbox-mboxmessage.html">7.3.2.2 <tt class="class">mboxMessage</tt></a>
<li><a href="mailbox-mhmessage.html">7.3.2.3 <tt class="class">MHMessage</tt></a>
<li><a href="mailbox-babylmessage.html">7.3.2.4 <tt class="class">BabylMessage</tt></a>
<li><a href="mailbox-mmdfmessage.html">7.3.2.5 <tt class="class">MMDFMessage</tt></a>
</ul>
<!--End of Table of Child-Links-->
</div>

<div class="navigation">
<div class='online-navigation'>
<p></p><hr />
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td class='online-navigation'><a rel="prev" title="7.3.1.5 MMDF"
  href="mailbox-mmdf.html"><img src='../icons/previous.png'
  border='0' height='32'  alt='Previous Page' width='32' /></a></td>
<td class='online-navigation'><a rel="parent" title="7.3 mailbox  "
  href="module-mailbox.html"><img src='../icons/up.png'
  border='0' height='32'  alt='Up one Level' width='32' /></a></td>
<td class='online-navigation'><a rel="next" title="7.3.2.1 MaildirMessage"
  href="mailbox-maildirmessage.html"><img src='../icons/next.png'
  border='0' height='32'  alt='Next Page' width='32' /></a></td>
<td align="center" width="100%">Python Library Reference</td>
<td class='online-navigation'><a rel="contents" title="Table of Contents"
  href="contents.html"><img src='../icons/contents.png'
  border='0' height='32'  alt='Contents' width='32' /></a></td>
<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
  border='0' height='32'  alt='Module Index' width='32' /></a></td>
<td class='online-navigation'><a rel="index" title="Index"
  href="genindex.html"><img src='../icons/index.png'
  border='0' height='32'  alt='Index' width='32' /></a></td>
</tr></table>
<div class='online-navigation'>
<b class="navlabel">Previous:</b>
<a class="sectref" rel="prev" href="mailbox-mmdf.html">7.3.1.5 MMDF</a>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="module-mailbox.html">7.3 mailbox  </a>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="mailbox-maildirmessage.html">7.3.2.1 MaildirMessage</a>
</div>
</div>
<hr />
<span class="release-info">Release 2.5.1, documentation updated on 18th April, 2007.</span>
</div>
<!--End of Navigation Panel-->
<address>
See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
</address>
</body>
</html>
